<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

    class offermodel extends CI_Model{

        function __construct()
        {
            parent::__construct();
        }
        function getAllOffer()
        {
            $data = array();
            $this->db->select('a.id,b.name,a.judul_offer,a.harga,a.tc_redeem,a.valid_at');
            $this->db->from('v_offer AS a');
            $this->db->join('v_company AS b', 'a.company_ref = b.id');
            $q = $this->db->get();
            if($q->num_rows > 0 )
            {
                foreach ($q ->result() as $row )
                {
                    /*$a = new stdClass();
                    $a = $row;
                    $a->img = base_url('assets/'.strtolower($row->name).'/'.$row->img);
                    $data[] = $a ;*/ //untuk link format gambar
                    $data[] = $row;
                }
            } 
            return $data;
        }
    }